package com.rran.study.designpattern.structural.decorator;

/**
 * @author yy
 * @Type PayParamsMsgServiceImpl.java
 * @Desc
 * @date 2020/7/27 12:10
 */
public class PayParamsMsgServiceImpl implements PayParamsMsgService {

    private PayService payService;

    public PayParamsMsgServiceImpl(PayService payService) {
        this.payService = payService;
    }
    //没有被装饰的支付=支付
    //装饰后的支付=支付前进行参数校验-->支付-->支付后发生信息
    @Override
    public void pay() {
        checkParams();
        payService.pay();
        sendMsg();
    }
    @Override
    public void sendMsg() {
        System.out.println("发送支付成功站内信");
    }
    @Override
    public void checkParams() {
        System.out.println("校验余额是否足够，校验密码是否非法登录等");
    }
}
